PROJECT = "led_test"
VERSION = "0.0.1"

log.info("main", PROJECT, VERSION)

sys = require("sys")

local LEDleft = gpio.setup(13, 1, gpio.PULLDOWN)
local LEDright = gpio.setup(12, 1, gpio.PULLDOWN)

sys.taskInit(function()
    while true do
        sys.wait(500)
        sys.publish("Ready")
    end
end)

sys.taskInit(function()
    while 1 do
        sys.waitUntil("Ready")
        LEDleft(0)
        sys.publish("Led")
        sys.wait(500)
        LEDleft(1)
    end
end)


sys.taskInit(function()
    while 1 do
        sys.waitUntil("Led")
        LEDright(1)
        sys.wait(500)
        LEDright(0)
    end
end)

sys.run()

